<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
        }

        .container {
            max-width: 900px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }

        h2 {
            text-align: center;
            color: #333;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        thead {
            background-color: #f2f2f2;
        }

        th, td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        .actions button {
            margin-right: 5px;
            padding: 6px 10px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .edit {
            background-color: #4CAF50;
            color: white;
        }

        .delete {
            background-color: #f44336;
            color: white;
        }

        .pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top: 20px;
            gap: 10px;
        }

        .pagination button {
            padding: 6px 12px;
            border: 1px solid #ccc;
            background-color: #fff;
            cursor: pointer;
            border-radius: 4px;
        }

        .pagination button:hover {
            background-color: #eee;
        }

        .active-page {
            background-color: #4CAF50 !important;
            color: white !important;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>用户管理</h2>
    <table>
        <thead>
            <tr>
                <th>用户名</th>
                <th>学号</th>
                <th>性别</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody id="userTableBody">
            <!-- 示例数据 -->
            <tr>
                <td>曾冬诚</td>
                <td>230320204018</td>
                <td>男</td>
                <td class="actions">
                    <button class="edit">修改</button>
                    <button class="delete">注销</button>
                </td>
            </tr>
            <tr>
                <td>王名举</td>
                <td>230320204024</td>
                <td>男</td>
                <td class="actions">
                    <button class="edit">修改</button>
                    <button class="delete">注销</button>
                </td>
            </tr>
            <tr>
                <td>朱坤</td>
                <td>230320204019</td>
                <td>男</td>
                <td class="actions">
                    <button class="edit">修改</button>
                    <button class="delete">注销</button>
                </td>
            </tr>
            <tr>
                <td>吴竣玮</td>
                <td>230320204008</td>
                <td>男</td>
                <td class="actions">
                    <button class="edit">修改</button>
                    <button class="delete">注销</button>
                </td>
            </tr>
            <tr>
                <td>赵奇峰</td>
                <td>230320204031</td>
                <td>男</td>
                <td class="actions">
                    <button class="edit">修改</button>
                    <button class="delete">注销</button>
                </td>
            </tr>
        </tbody>
    </table>

    <!-- 分页 -->
    <div class="pagination">
        <button onclick="changePage(-1)">上一页</button>
        <span id="pageInfo">第 <span id="currentPage">1</span> 页 / 共 <span id="totalPages">1</span> 页</span>
        <button onclick="changePage(1)">下一页</button>
    </div>
</div>

<script>
    let currentPage = 1;
    const totalPages = 10;

    function updatePageDisplay() {
        document.getElementById('currentPage').textContent = currentPage;
        document.getElementById('totalPages').textContent = totalPages;
    }

    function changePage(delta) {
        currentPage += delta;
        if (currentPage < 1) currentPage = 1;
        if (currentPage > totalPages) currentPage = totalPages;
        updatePageDisplay();
        // 此处可添加请求新页码数据的逻辑
    }

    // 初始化分页显示
    updatePageDisplay();

    // 添加点击事件到按钮
    document.querySelectorAll('.edit').forEach(button => {
        button.addEventListener('click', () => {
            alert('跳转至修改资料页面');
            // 可替换为 window.location.href 或弹窗编辑表单
        });
    });

    document.querySelectorAll('.delete').forEach(button => {
    button.addEventListener('click', () => {
        window.location.href = '设计3.html'; // 跳转到注销确认页面
    });
});
</script>

</body>
</html>